package com.atguigu.gulimall.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author baiWT
 * @Description
 * @Date 2022/3/28 17:09
 **/
@Configuration
public class MyRedissonConfig {

    /**
     * 所有对redisson的使用都是通过redissonClent对象
     * @return
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson(){
        //1、创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.6.129:6379");

        //2、根据config创建出redissonClent示例
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }
}
